// =============================================================
// CWork for IST(Index/Search Tool)
// ---------------------------------------
// Author : Woo-Hyun Kim
// Email : woorung@icu.ac.kr or woorung@nhncorp.com
// Date : Jul. 25, 2006
// =============================================================
#ifndef CWorkH
#define CWorkH
//-----------------------------------------------------------------
#include <iostream>
#include <iterator>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <fstream>
#include <string>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

#include "CShellProcess.h"
#include "CInterpreter.h"
#include "CIndexInterpreter.h"
#include "CCubeInterpreter.h"

using namespace std;
//---------------------------------------------------------------
class CWork {
private :
	string type;
	string name;
	int current_pos;

	map<string,string> common_task_variables;
	map<string,string> task_variables;
	map<string,string> work_variables;

	vector<CShellProcess> commands;

public :
	CWork(string &type, string &name);
	~CWork();

	int registerCommand(string &command);
	int registerCommonTaskVariables(map<string,string> &variables);
	int registerTaskVariables(map<string,string> &variables);
	int registerWorkVariables(map<string,string> &variables);

	string &getName();
	string &getType();
	int hasMoreCommands();
	string &getNextCommand();
	string &getParameter(char *cattr);
	string &getParameter(string &attr);

	void perform();
};
//----------------------------------------------------------------
#endif
